! for cracmm1_aq
!
IRRTYPE = PARTIAL;
DEFINE FAMILY NOX = NO + NO2;
DEFINE FAMILY ORG_NO3 = ADCN + ISON + OLND+ OLNN + ONIT + TRPN + NALD;
DEFINE FAMILY PANS = PAN +PPN +MPAN;
DEFINE FAMILY NOZ = PAN + PPN + MPAN + HONO + HNO4 + 2*N2O5 + ADCN
+ ISON + SESQNRO2
+ OLND+ OLNN + ONIT + TRPN + HNO3;
DEFINE FAMILY OX  = O3 +NO2 +2*NO3 + O3P + O1D +PAN +3*N2O5 + HNO4 +PPN 
+ MPAN;
DEFINE FAMILY HOX    = HO + HO2;
DEFINE FAMILY RO3S = ACO3 + RCO3;
DEFINE FAMILY RO2S = MO2 + ACTP + ISOP + KETP + LIMALP + LIMNP1 
+ LIMNP2
+ HC10P + HC10P2 + HC3P + HC5P + LIMP1 + LIMP2 + MACP + MCP + MEKP 
+ MVKP + NAPHP + OLTP 
+ XYEP + XYMP + XO2 + APINP1 + APINP2 + APIP1 + APIP2 + PINALP
+ BAL1 + BAL2 + BALP + BDE13P + BENP + ETEP + ETHP + FURANO2
+ VROCP5AROP + VROCP6AROP
+ SESQNRO2 + SESQRO2 + UALP + OLIP + ORAP + TOLP
+ VROCP6ALK + VROCP1ALKP + VROCP2ALKP + VROCP3ALKP
+ VROCP4ALKP + VROCP5ALKP + VROCP6ALKP + VROCP1ALKP2
+ VROCP2ALKP2 + VROCP3ALKP2 + VROCP4ALKP2 + VROCP5ALKP2
+ VROCP6ALKP2;

DEFINE FAMILY RO2NS = LIMNP1 + LIMNP2 + APINP1 + APINP2 + VROCP1ALKP2
+ VROCP2ALKP2 + VROCP3ALKP2 + VROCP4ALKP2 + VROCP5ALKP2
+ SESQNRO2 + VROCP6ALKP2 + HC10P2;

DEFINE FAMILY RO2OS = MO2 + ACTP + ISOP + KETP
+ HC10P + HC3P + HC5P + LIMP1 + LIMP2 + MACP + MCP + MEKP
+ MVKP + NAPHP + OLTP
+ VROCP5AROP + VROCP6AROP
+ XYEP + XYMP + XO2 + APIP1 + APIP2 + PINALP
+ BAL1 + BAL2 + BALP + BDE13P + BENP + ETEP + ETHP + FURANO2
+ SESQRO2 + UALP + OLIP + ORAP + TOLP
+ VROCP6ALK + VROCP1ALKP + VROCP2ALKP + VROCP3ALKP
+ VROCP4ALKP + VROCP5ALKP + VROCP6ALKP;

DEFINE FAMILY BIO_RO2S = ISOP + LIMALP + LIMNP1
+ LIMNP2 + LIMP2 + PINALP + MACP 
+ MVKP + APINP1 + APINP2 + APIP1 + APIP2 
+ SESQNRO2 + SESQRO2;

DEFINE FAMILY AROM_RO2S = BENP + TOLP + XYEP + XYMP + NAPHP
+ VROCP5AROP + VROCP6AROP;

DEFINE FAMILY ANTHRO_VOC = HCHO + ACD + ACT + UALD + KET + TOL 
+ XYE 
+ HC5 + HC10 + XYM + ACRO + ALD + BALD + BEN + BDE13 + CSL + DCB1 
+ EOH + HC3 + ETE + ETEG + ETH + FURAN + GLY + HKET + MACR + MCT 
+ MEK + NAPH + MGLY + MVK + OLI + OLT + ORA1 + ORA2 + PHEN + PROG
+ VROCIOXY + ROH + SLOWROC;

DEFINE FAMILY BIO_VOC =  ISO + LIM + LIMAL + PINAL + API + SESQ;

DEFINE FAMILY ISOPRENE_SOA = AISO3NOSJ + AISO3OSJ;

DEFINE FAMILY ISOPRENE_VOC = ISHP + MVK + MACR + ISON + IEPOX;

DEFINE FAMILY SVSOA_VAPALK = VROCP1ALK;

DEFINE FAMILY HVSOA_VAPALK = VROCP2ALK + VROCP3ALK;

DEFINE FAMILY LVSOA_VAPOXY = VROCN2OXY2 + VROCN2OXY4 + VROCN2OXY8 
+ VROCN1OXY1 + VROCN1OXY3 + VROCN1OXY6;

DEFINE FAMILY SVSOA_VAPOXY = VROCP0OXY2 + VROCP0OXY4 + VROCP1OXY1
+ VROCP1OXY3;

DEFINE FAMILY HVSOA_VAPOXY = VROCP2OXY2 + VROCP3OXY2 + OP3;

DEFINE FAMILY VROC_OXYS = VROCN2OXY2 + VROCP4OXY2 + VROCN1OXY6 + VROCP3OXY2
 + VROCP0OXY4 + VROCIOXY + VROCP0OXY2 + VROCP1OXY3 + VROCP2OXY2 + VROCP1OXY1
 + VROCN1OXY1 + VROCN2OXY4 + VROCN1OXY3 + VROCN2OXY8 + VROCP5OXY1
 + VROCP6OXY1 + OP3;

DEFINE FAMILY VROC_ALKS = VROCP6ALK + VROCP6ALKP + VROCP5ALK + VROCP5ALKP
 + VROCP4ALK + VROCP4ALKP + VROCP3ALK + VROCP3ALKP + VROCP2ALK + VROCP2ALKP
 + VROCP1ALK + VROCP1ALKP + VROCP6ALKP2 + VROCP5ALKP2 + VROCP4ALKP2
 + VROCP3ALKP2 + VROCP2ALKP2 + VROCP1ALKP2;
!!=======================================================================
! Reaction Sum Definitions 
!=======================================================================

DEFINE CYCLE PANcyc = PAN;
DEFINE CYCLE PPNcyc = PPN;
DEFINE CYCLE MPANcyc = MPAN;
DEFINE CYCLE HNO4cyc = HNO4;
! need to work on cycles because reaction labels from cb6r5 if lobal number is two digits

DEFINE RXNSUM HNO4_HO2cyc      = 0.80*<R009> + <R066> - <R067>;
DEFINE RXNSUM HONOcyc = <R049> - <R007> - <R053>;
DEFINE RXNSUM NO3cyc = <R037> - <R006>;
! uncertain if only consider reaction involve HOX as reaction orproduct 
DEFINE RXNSUM CH3OO_cyc = <R028> - <R212>;
DEFINE RXNSUM C2H6OOcyc = <R029> - 0.780*<R102> - 0.790*<R103>
- 0.650*<R136> - 0.650*<R137> - 0.680*<R202> - <R207> 
- <R213> - <R214> - <R215>
- <R217> - <R218> - <R219> - 0.602*<ROCARO32> - 0.720*<ROCARO42>
- 0.480*<ROCARO52> - 0.085*<ROCARO62> - 0.850*<R233> - <R235> - <R238> 
- <R239> - <R242> - <R243> - <R246> - <R247> - 0.680*<R278>
- 0.700*<R283> - 0.680*<R314> - 0.700*<R319> - 0.680*<R352>
- 0.620*<ROCARO32> - 0.720*<ROCARO42> - 0.048*<ROCARO52> - 0.085*<ROCARO62>
- <R357> - <T10c> - <R005c> - <HC1004> - 0.004*<ROCOXY2c>
-  0.013*<ROCOXY5c> -  0.006*<ROCOXY6c> - 0.005*<ROCOXY7c>
-  0.017*<ROCOXY9c> -  0.003*<ROCOXY10c> -  0.011*<ROCOXY12c>
-   0.013*<ROCOXY13c> -  0.038*<ROCOXY14c> -  0.059*<ROCOXY15c>;
DEFINE RXNSUM N2O5cyc      = <R063> - <R064>;
DEFINE RXNSUM H2O2_OHcyc =  <R003> -<R045> - <R046>;
DEFINE RXNSUM HOXcyc =  <R034> - <R035>;


!DEFINE CYCLE LVSOA_VAPALKcyc = LVSOA_VAPALK;
!DEFINE CYCLE SVSOA_VAPALKcyc = SVSOA_VAPALK;
!DEFINE CYCLE HVSOA_VAPALKcyc = HVSOA_VAPALK;
!DEFINE CYCLE LVSOA_VAPOXYcyc = LVSOA_VAPOXY;
!DEFINE CYCLE SVSOA_VAPOXYcyc = SVSOA_VAPOXY;
!DEFINE CYCLE HVSOA_VAPOXYcyc = HVSOA_VAPOXY;
!======================================================================
! IPR_OUTPUTS
!=======================================================================
IPR_OUTPUT O3    =  CHEM+DDEP+CLDS+AERO+TRNM;
IPR_OUTPUT HNO3  =  CHEM+DDEP+CLDS+AERO;
IPR_OUTPUT PAN   =  CHEM+DDEP+CLDS+AERO+TRNM;
IPR_OUTPUT N2O5  =  CHEM+DDEP+CLDS+AERO;
IPR_OUTPUT HCHO  =  CHEM+DDEP+CLDS+AERO;
IPR_OUTPUT SVSOA_VAPALK = CHEM;
IPR_OUTPUT HVSOA_VAPALK = CHEM;
IPR_OUTPUT LVSOA_VAPOXY = CHEM;
IPR_OUTPUT SVSOA_VAPOXY = CHEM;
IPR_OUTPUT HVSOA_VAPOXY = CHEM;


DEFINE FAMILY EC = AECI + AECJ;
IPR_OUTPUT EC = COAG + EMIS + HADV;
IPR_OUTPUT ASO4J = COND + COAG + EMIS + CHEM + VDIF + CLDS;
IPR_OUTPUT ASO4I = NPF + COND + COAG + EMIS + CHEM + VDIF +CLDS;
!IPR_OUTPUT NUMATKN;
!IPR_OUTPUT NUMACC;
!IPR_OUTPUT NUMCOR;
!=======================================================================
! IRR_OUTPUTS
! OX prod and loss
!
IRR_OUTPUT O3prod = NETP[O3];
IRR_OUTPUT OxPROD = NETP[OX];
IRR_OUTPUT OxLOSS = NETL[OX];
IRR_OUTPUT OxLOSSHAL = <HAL_Ozone>;

! factors influencing PAN and N2O5 concentrations
!
IRR_OUTPUT PANprod = PANcyc[POSONLY];
IRR_OUTPUT PANloss = PANcyc[NEGONLY];

! RO2 fate
IRR_OUTPUT RO2withNOtoNO2 = PROD[NO2] FROM [RO2S] AND [NO]
+ PROD[NO2] FROM [RO3S] AND [NO];
IRR_OUTPUT NRO2withNOtoNO2 = PROD[NO2] FROM [RO2NS] AND [NO];
IRR_OUTPUT RO2withNOtoNTR = PROD[ORG_NO3] FROM [RO2S] AND [NO];
IRR_OUTPUT RO3withNO2toPAN = PROD[PANS] FROM [RO3S] AND [NO2];
IRR_OUTPUT ROXwithHO2 = LOSS [RO2S] AND [HO2] + LOSS [RO3S] AND [HO2];
IRR_OUTPUT ROXwithRO2 = LOSS [RO2S] AND [RO2S] + LOSS [RO3S] AND [RO2S];

! VOC fate
IRR_OUTPUT ANTHRO_VOC_OH = LOSS[ANTHRO_VOC] AND [HO];
IRR_OUTPUT ANTHRO_VOC_O3 = LOSS[ANTHRO_VOC] AND [O3];
IRR_OUTPUT ANTHRO_VOC_NO3 = LOSS[ANTHRO_VOC] AND [NO3];
IRR_OUTPUT BIO_VOCwithOH = LOSS[BIO_VOC] AND [HO];
IRR_OUTPUT BIO_VOCwithO3 = LOSS[BIO_VOC] AND [O3];
IRR_OUTPUT BIO_VOCwithNO3 = LOSS[BIO_VOC] AND [NO3];

! New radicals
IRR_OUTPUT OHfrO1D = PROD [HO] FROM [O1D];
!
IRR_OUTPUT NewHOxfromHCHO =2.0*<R011>; 
IRR_OUTPUT NewHOxfromH2O2 =2.0*H2O2_OHcyc[POSONLY];
IRR_OUTPUT NewHOxfromHONO = HONOcyc[NEGONLY]; 
IRR_OUTPUT NewHOxfromHNOX = HNO4cyc[NEGONLY]; 
! from photolysis not including HCHO, HNO3 and HNO4
IRR_OUTPUT NewHOxfromhv = <R012> + <R013> + 1.22*<R015> + <R018>
+ <R019> + 2.0*<R023> + <TRP01> + <TRP02> + <R024> + 1.5*<R025> 
+ 1.5*<R026> + <R027> + 2.0*<R028> + 2.0*<R029> + 2.0*<TRP03>
+ 2.0*<R029a> + <R030> + <R031>;
! from O3+alkene reactions
IRR_OUTPUT NewHOxfromO3 =0.230*<R126> + 0.550*<R127> + 0.530*<R128> +0.500*<R130>
+0.900*<R131> + 0.840*<R132>;  

!radical loss from heterogeneous reactions
IRR_OUTPUT NO2_LOSS_HET = <HET_N02>;

! NOz production rates
! use for O3 production efficiency = p(O3)/net_prod(NOz)
IRR_OUTPUT NOZ_net_prod = NETP[NOZ];

! use for O3 production efficiency = p(O3)/net_loss(NOx)
IRR_OUTPUT NOX_net_loss = NETL[NOX];

! use for O3 production efficiency = p(O3)/(NOz)= O3prod/NOZfromNOX
IRR_OUTPUT NOZfrNOX = PANcyc[POSONLY] + PPNcyc[POSONLY] + MPANcyc[POSONLY] 
+ HONOcyc[POSONLY] + HNO4cyc[POSONLY] + NO3cyc[POSONLY] + N2O5cyc[POSONLY]
+ PROD[ORG_NO3] FROM [NOX] + PROD[HNO3] FROM [NOX];

! ASOAT production
IRR_OUTPUT Prod_ASOAT_tot = PROD[ASOATJ];
IRR_OUTPUT Prod_ASOAT_NOz = PROD[ASOATJ] FROM [NOX]
+ PROD[ASOATJ] FROM [NO3];

! HNO3 formation pathways
IRR_OUTPUT HNO3prod = NETP[HNO3];
IRR_OUTPUT HNO3fromOHNO2 = <R056>;
IRR_OUTPUT HNO3fromN2O5 = <HET_N2O5>;
IRR_OUTPUT HNO3fromNO3 = PROD[HNO3] FROM [NO3];

!H2O2 production
IRR_OUTPUT H2O2prod = NETP[H2O2];

! formaldehyde production and loss
IRR_OUTPUT HCHOprod_tot = PROD[HCHO];
IRR_OUTPUT HCHOprod_bio = PROD[HCHO] FROM [BIO_VOC]
+ PROD[HCHO] FROM [BIO_RO2S] + PROD[HCHO] FROM [ISOPRENE_VOC];
IRR_OUTPUT LOSS_HCHO = LOSS[HCHO];

!production and loss for acetaldehyde and acrolein
IRR_OUTPUT PROD_CH3CHO = PROD[ACD];
IRR_OUTPUT PROD_ACROLEIN = PROD[ACRO];
IRR_OUTPUT LOSS_ACD = LOSS[ACD];
IRR_OUTPUT LOSS_ACRO = LOSS[ACRO];

! alkyl nitrate pathways
!
IRR_OUTPUT ORGNO3prod = NETP[ORG_NO3];
IRR_OUTPUT ORGNO3viaISO = PROD[ORG_NO3] FROM [ISOP];
IRR_OUTPUT ORGNO3viaTERP = PROD[TRPN];
IRR_OUTPUT ISONprod = PROD[ISON];
IRR_OUTPUT TERPNO2fromTERP = PROD[SESQNRO2] FROM [SESQ]
+ PROD[APINP1] FROM [API] + PROD[APINP2] FROM [API] 
 + PROD[LIMALP] FROM [LIMAL]+ PROD[LIMNP1] FROM [LIMAL]
 + PROD[LIMNP2] FROM [LIMAL] 
 + PROD[LIMP1] FROM [LIM] + PROD[LIMP2] FROM [LIM];
IRR_OUTPUT SOAviaISOPRENE = PROD[ISOPRENE_SOA];
!
ENDPA;
